<!DOCTYPE html>
<head> 
    <meta charset="utf-8"> 
    <title>插入数据到数据库</title>  
</head>
<?php
	//连接数据库
	$conn = @mysql_connect("localhost","root","sdata007");
	if(!$conn){
		die("连接数据库失败：". mysql_error());
	}else{
		echo "连接数据库成功";
		echo "<br>";
	}
	//选择数据库
	mysql_select_db("testdb",$conn);
	mysql_query("set names 'utf8'");
	$password = md5("24234_sadf");
	$regdate = time();
	$sql = "INSERT INTO myuser(username, password, email, regdate)VALUES('怕怕', '$password', 'papa@163.com', $regdate)";
	if(!mysql_query($sql,$conn)){
		echo "操作失败：" . mysql_error();
	}else{
		echo "操作成功！";	
	}
	mysql_close( $conn );
?>